In this report, we explore a dataset provided by the California Department of Fish and Wildlife, published for the intention of providing relevant California oil spill data to the Office of Spill Prevention and Response (OSPR). Using different styles of mapping, we look at the distribution of oil spills throughout the state, locating counties where oil spill are most prevelant.
# clean subset of counties, clean names and select variables (don't have to select geometry, automatically included)
ca_subset_sf <- ca_counties_sf %>%
clean_names() %>%
select(name, aland)
# # inspect coordinate system for counties sf
# ca_subset_sf %>%
# st_crs()
# # ID["EPSG",3857]
# change oil_dat into an sf object and make crs consistent with metadata
oil_dat_sf <- st_as_sf(oil_dat, coords = c("longitude", "latitude"),
crs = 4326)
# transform crs to be consistent with ca counties sf
oil_dat_3857_sf <- st_transform(oil_dat_sf, 3857)
# # inspect coordinate system for oil_dat crs transformed sf
# oil_dat_3857_sf %>%
# st_crs()
# # ID["EPSG",3857]
# interactive map
# set interavtice map mode
tmap_mode(mode = "view") +
# set basemap
tm_basemap(providers$Esri.OceanBasemap) +
# set data for counties shape
tm_shape(ca_subset_sf) +
# define fill, palette, and remove legend
tm_fill("name", palette = ghibli_palettes$PonyoLight,
legend.show = FALSE) +
# add oil spill data points
tm_shape(oil_dat_3857_sf) +
# change dot color and border
tm_dots("firebrick4", border.col = "black")